precision mediump float;
varying vec3 v_lightPos;
varying vec3 v_pos;
varying vec4 v_color;
varying vec3 v_norm;

void main() {
	vec3 diff = v_lightPos - v_pos;
	float dist = length(diff);
    vec3 lightVec = normalize(diff);
    float diffuse = max(dot(v_norm, lightVec), 0.1) * (1.0 / (1.0 + (0.25 * dist * dist))) + .15;

    gl_FragColor = v_color * diffuse;
    
	//vec4 purple = vec4(.5, .2, .6, 1.);
	/*float diffuse = dot(v_norm, lightVec) * (1./ (.5*dist));

	gl_FragColor = v_color * step(-.1, diffuse) *
                ((1. - step(.1, diffuse) * -.2)) *
                  ((1. - step(.4, diffuse) * -.1)) *
                  ((1. - step(.70, diffuse) * -.1));// +.1;*/
}
